<template>
	<div>
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="sno"
      label="编号"
      width="50">
    </el-table-column>
    <el-table-column
      prop="sname"
      label="名称"
      width="150">
    </el-table-column>
    <el-table-column
      prop="sshort"
      label="简称"
      width="100">
    </el-table-column>
    <el-table-column
      prop="saddress"
      label="地址"
      width="150">
    </el-table-column>
    <el-table-column
      prop="sphone"
      label="公司电话"
      width="120">
    </el-table-column>
    <el-table-column
      prop="semile"
      label="邮件"
      width="150">
    </el-table-column>
	<el-table-column
	  prop="slinkman"
	  label="联系人"
	  width="120">
	</el-table-column>
	<el-table-column
	  prop="slinkmanphone"
	  label="联系人电话"
	  width="120">
	</el-table-column>
	<el-table-column
	  prop="sremark"
	  label="备注"
	  width="150">
	</el-table-column>
  </el-table>
  <el-pagination
    background
    layout="prev, pager, next"
	page-size="5"
    :total="total"
	@current-change="page">
  </el-pagination>
  </div>
</template>

<script>
  export default {
	  name: "SupplierSearch2",
    methods: {
		deletesupplier(row){
			const _this = this
			axios.delete('http://localhost:8181/supplier/deleteById/'+row.sno).then(function(resp){
					_this.$message('删除成功！');
					window.location.reload();				
			})
		},
	edit(row) {
	  this.$router.push({
				path:'/supplierupdate',
				query:{
					id:row.sno
				}
			})
	},
	  page(currentPage){
		  const _this = this
		  axios.get('http://localhost:8181/supplier/findAll/'+currentPage+'/5').then(function(resp){
		  	_this.tableData = resp.data.content
		  	_this.total = resp.data.totalElements
		  })
	  }
    },
	created(){
		const _this = this
		axios.get('http://localhost:8181/supplier/findAll/1/5').then(function(resp){
			console.log(resp)
			_this.tableData = resp.data.content
			_this.total = resp.data.totalElements
		})
		
	},
    data() {
      return {
		  total: null,
			tableData: null
      }
    }
  }
</script>
